package org.gpp.proj1.ui.gui;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class InitStatusWindow extends JFrame {

	private static final long serialVersionUID = 6129001134030187136L;

	private JTextArea statusMessages;
	
    private JScrollPane textPanel;

    public InitStatusWindow() {
    	
        initComponents();
        
        this.setLocationRelativeTo( null ); 
    }
    
    private void initComponents() {
        textPanel = new JScrollPane();
        statusMessages = new JTextArea();

        setTitle("Initializing game");
        setResizable(false);
        statusMessages.setColumns(20);
        statusMessages.setEditable(false);
        statusMessages.setRows(5);
        statusMessages.setText("Initializing...\n");
        textPanel.setViewportView(statusMessages);
        textPanel.setAutoscrolls( true );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(textPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(textPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                .addContainerGap())
        );
        pack();
    }

	public void updateStatus(String message) {
		
		this.statusMessages.append( message + "\n" );
	}
}
